#pragma once

#include <QDialog>
#include <QPushButton>
#include <QLabel>
#include "publicgui_global.h"

class QTreeWidget;
class QLineEdit;
class QTreeWidgetItem;

namespace PublicGui
{
	class PUBLICGUI_EXPORT AreaTreeDialog : public QDialog
	{
		Q_OBJECT
	public:
		AreaTreeDialog(QWidget* parent=0,Qt::WindowFlags f=0);
		~AreaTreeDialog();
		enum DialogState
		{
			InputOnly,
			CanEdit,
			CanSelect,
			ALL,
		};
		void setDialogState(DialogState state);
		QString getLineEditText();
		void showOrHideAllArea();
	private:
		void initTree();
		QPushButton*							_unGroupButton;
		QPushButton*							_okButton;
		QPushButton*							_cancelButton;
		QLineEdit*								_nameLineEdit;
		QTreeWidget*							_areaTree;
		DialogState								_dialogState;
		bool									_isShow;
	protected:
		virtual void showEvent(QShowEvent* event);
	private slots:
		void slotsEnter();
		void slotsUnGroup();
		void slotsCurrentMapChanged();
		void slotsItemChanged(QTreeWidgetItem*,int);
	};
}